import 'package:json_annotation/json_annotation.dart';

part 'bus_info_model.g.dart';

@JsonSerializable()
class BusInfoModel {
  final int? id;
  final int? changeSetId;
  final int? lineStopType;
  final String? name;
  final String? partStart;
  final String? partHighlight;
  final String? partEnd;
  final int? lineType;
  final dynamic fromStaName;
  final dynamic toStaName;
  final bool? isFavorite;
  final List<NameAndIsSingles>? nameAndIsSingles;

  const BusInfoModel({
    this.id,
    this.changeSetId,
    this.lineStopType,
    this.name,
    this.partStart,
    this.partHighlight,
    this.partEnd,
    this.lineType,
    this.fromStaName,
    this.toStaName,
    this.isFavorite,
    this.nameAndIsSingles,
  });

  factory BusInfoModel.fromJson(Map<String, dynamic> json) =>
      _$BusInfoModelFromJson(json);

  Map<String, dynamic> toJson() => _$BusInfoModelToJson(this);
}

@JsonSerializable()
class NameAndIsSingles {
  final String? name;
  final int? lineType;

  const NameAndIsSingles({
    this.name,
    this.lineType,
  });

  factory NameAndIsSingles.fromJson(Map<String, dynamic> json) =>
      _$NameAndIsSinglesFromJson(json);

  Map<String, dynamic> toJson() => _$NameAndIsSinglesToJson(this);
}
